<?php use_helper('Pagination') ?>
<?php slot('coursesNav', 'active') ?>
<div class="courses" id="wrapper">
	<?php include_partial('global/systemMessages') ?>
	<div id="content">
		<div style="clear: both; text-align: center">
		<?php echo pager_navigation($courses_pager, 
			'fixnotes/edit?note_id='.$sf_request->getParameter('note_id')
			.'&notes_page='.$sf_request->getParameter('notes_page')
			.'&term='.$sf_request->getParameter('term')
		) ?>
		</div>
		<br/>
		<fieldset>
			<legend>Notes Detail</legend>
			<p>id: <?php echo $note->getId() ?></p>
			<p>user_id: <?php echo $note->getUserId()?></p>
			<p>course_id: <?php echo $note->getCourseId() ?></p>
			<p>semester: <?php echo $note->getSemester() ? $note->getSemester() : "" ?></p>
			<p>current course: <?php //echo $note->getCourse()->getName() ?></p>
			<p><label>Topic: <?php echo $note->getTopic() ?></label></p>
			<p>Text:</p>
			<p><?php echo render_note_summary($note, 1024)?></p>
		</fieldset>
		<hr/>
		<p><?php echo link_to("Delete this note", "fixnotes/update?delete_id=".$note->getId())?>
		<br/>
		<fieldset>
			<form action="<?php echo url_for('fixnotes/edit')?>" method="post">
			<p>Search for a Course: <input type="text" value="" size="40" name="term" />
			<input type="submit" name="search" value="search" />
			</p>
			<input type="hidden" name="notes_page" value="<?php echo $sf_request->getParameter('notes_page',1) ?>" />
			<input type="hidden" name="note_id" value="<?php echo $sf_request->getParameter('note_id') ?>" />
			</form>
		</fieldset>
		<br/>
		<hr/>
		<br/>
		<?php if($sf_request->getParameter('term')): ?>
			<h1 style="font-size: 20px;">
			Found <?php echo $courses_pager->getNbResults() ?> search results for			 
				&apos;<?php echo $sf_request->getParameter('term')?>&apos;</h1>
			
		<?php endif?>
		<fieldset>
			<legend>Select a New Course</legend>
			<?php foreach($courses_pager->getResults() as $course): ?>
			<p>id: <?php echo $course->getId() ?></p>
			<p>Name: <?php echo $course->getName() ?></p>
			<p>Subject: <?php echo $course->getSubject() ? $course->getSubject()->getName() : '' ?></p>
			<p>Section: <?php echo $course->getSection() ? $course->getSection() : '' ?></p>
			<p><?php echo link_to('RE-ASSOCIATE all notes currently mapped to Course #'.$note->getCourseId().' TO Course #'.$course->getId(), 'fixnotes/update?note_id='.$sf_request->getParameter('note_id')
				.'&notes_page='.$sf_request->getParameter('notes_page', 1)
				.'&course_id='.$course->getId()
			)?>
			<hr/>
			<?php endforeach ?>
		</fieldset>
		<br/><br/>
		<?php echo pager_navigation($courses_pager, 
			'fixnotes/edit?note_id='.$sf_request->getParameter('note_id')
			.'&notes_page='.$sf_request->getParameter('notes_page')
			.'&term='.$sf_request->getParameter('term')
		) ?>
		</div>
	</div>
</div>
